Skip to content

atomic: use sequence_handler and drmEventcontext version 4#236

Draft
gulafaran wants to merge 2 commits into
hyprwm:mainfrom
gulafaran:crtcseq
Draft

atomic: use sequence_handler and drmEventcontext version 4#236
gulafaran wants to merge 2 commits into
hyprwm:mainfrom
gulafaran:crtcseq

Conversation

@gulafaran

Copy link
Copy Markdown
Contributor

use CRTC Sequence handler if we can, poll the current sequence drmCrtcGetSequence and if it succeeds, try queue the next one if we can or fallback to the old pageflip handler.

by using crtc sequences we are allowed a much higher resolution timestamp and get much more correct timestamps for our presentation events that is not rounded away.

will reduce jitters and drifting in timestamps and get us lower latencies.

Comment thread include/aquamarine/backend/DRM.hpp Outdated
Comment thread src/backend/drm/DRM.cpp
.version = 3,
.version = 4,
.page_flip_handler2 = ::handlePF,
.sequence_handler = ::handleCRTCSequence,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if drm doesn't support version 4? We should check this somewhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its behind a #if #endif check now which technically shouldnt be needed, but who knows what bsd ships so oh well doesnt hurt. the getcrtc will fail if driver doesnt support this, so its never queued and never triggered. and it goes the pageflip path.

@gulafaran gulafaran marked this pull request as draft February 7, 2026 19:01
use CRTC Sequence handler if we can, poll the current sequence
drmCrtcGetSequence and if it succeeds, try queue the next one if we can
or fallback to the old pageflip handler.

by using crtc sequences we are allowed a much higher resolution
timestamp and get much more correct timestamps for our presentation
events that is not rounded away.

will reduce jitters and drifting in timestamps and get us lower latencies.
make the pageflips be the one that drives the frames if we can, instead
of always relying on returning early and waiting for dispatching idle,
it makes the start of each frame wait an large amount of time.

do this by adding a isFrameRunning and dont schedule an idle frame if
set.
@gulafaran

Copy link
Copy Markdown
Contributor Author

sadly looks like nvidia doesnt support this anyways :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants